package org.nepu.scr.indexrate.converter.drillingrate.keydevice.improvesystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.improvesystem.NetEmptyHeightOfBase;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class NetEmptyHeightOfBaseConverter implements AttributeConverter<NetEmptyHeightOfBase, String> {
    @Override
    public String convertToDatabaseColumn(NetEmptyHeightOfBase netEmptyHeightOfBase) {
        return JSONUtil.toJsonStr(netEmptyHeightOfBase);
    }

    @Override
    public NetEmptyHeightOfBase convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, NetEmptyHeightOfBase.class);
    }
}
